package com.yazi.mxz.server.response;


/**
 * 状态响应对象
 * 
 * @author mo_yq5
 * @date 2014-5-6
 */
public class StatusResponse {
	public static final String STATUS_OK = "ok";
	public static final String STATUS_FAIL = "fail";
	public static final String STATUS_ERROR = "error";

	/**
	 * 状态
	 */
	private String status = STATUS_FAIL;
	/**
	 * 状态信息描述
	 */
	private String message = "unknown";
	/**
	 * 错误码
	 */
	private String code = "";


	/**
	 * 设为成功状态
	 */
	public void setOk() {
		this.status = STATUS_OK;
		this.message = STATUS_OK;
	}

	/**
	 * 设为失败状态
	 */
	public void setFail() {
		this.status = STATUS_FAIL;
	}

	/**
	 * 设为错误状态
	 */
	public void setError() {
		this.status = STATUS_ERROR;
	}

	/**
	 * 指定结果码
	 * 
	 * @param code
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * 指定结果描述信息
	 * 
	 * @param msg
	 */
	public void setMessage(String msg) {
		this.message = msg;
	}

	/**
	 * 指定成功信息
	 * 
	 * @param message
	 */
	public void setOkMessage(String message) {
		this.status = STATUS_OK;
		this.message = message;
	}

	/**
	 * 指定错误信息
	 * 
	 * @param message
	 */
	public void setFailMessage(String message) {
		this.status = STATUS_FAIL;
		this.message = message;
	}

	/**
	 * 指定错误码和错误信息
	 * 
	 * @param code
	 * @param message
	 */
	public void setFailMessage(String code, String message) {
		this.status = STATUS_FAIL;
		this.code = code;
		this.message = message;
	}

	/**
	 * 指定错误描述信息
	 * 
	 * @param message
	 */
	public void setErrorMessage(String message) {
		this.status = STATUS_ERROR;
		this.message = message;
	}

	/**
	 * 指定错误码和错误描述信息
	 * 
	 * @param code
	 * @param message
	 */
	public void setErrorMessage(String code, String message) {
		this.status = STATUS_ERROR;
		this.code = code;
		this.message = message;
	}

	/**
	 * 获得状态值
	 */
	public String getStatus() {
		return status;
	}

	/**
	 * 获得状态描述信息
	 * 
	 * @return
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * 获得错误码
	 * 
	 * @return
	 */
	public String getCode() {
		return code;
	}

	
	public void setStatus(String status) {
		this.status = status;
	}
}
